﻿/* Write a program that reads a text file and prints on the console its odd lines. */

using System;
using System.IO;

namespace _1.PrintFileOddLines
{
    class PrintFileOddLines
    {
        static void Main()
        {
            Console.Write("Path to file (along with the filename): ");
            string path_to_file = @Console.ReadLine();

            StreamReader SR = new StreamReader(path_to_file);
            int lineNumber = 1;

            string line = SR.ReadLine();
            using (SR)
            {
                while (line != null)
                {
                    //check for odd line
                    if (lineNumber % 2 != 0) Console.WriteLine("Line #{0}: {1}", lineNumber, line);
                    ++lineNumber;
                    line = SR.ReadLine();
                }
            }
        }
    }
}
